package day6;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class CardTest {

    @Test
    public void test01(){
        int rank;
        //花色 ♥,♦,♣,♠
        int suit;

        Card c1=new Card(0,0);
        System.out.println(c1);

        Card c2=new Card(Card.SUIT_HEITAO, Card.RANK_3);
        System.out.println(c2);
    }


    @Test
    public void testNewCardCreation() {
        // 测试NewCard对象能否正常创建
        NewCard newCard = new NewCard();
        assertNotNull(newCard);
        assertNotNull(newCard.cards);
        assertEquals(54, newCard.cards.length);
    }

    @Test
    public void testDisplayAllCards() {
        // 创建一副新牌
        NewCard newCard = new NewCard();

        // 显示所有54张牌
        System.out.println("一副完整的扑克牌：");
        for (int i = 0; i < newCard.cards.length; i++) {
            System.out.print(newCard.cards[i] + " ");

            // 每13张牌换一行，便于阅读
            if ((i + 1) % 13 == 0) {
                System.out.println();
            }
        }

        // 验证牌的总数
        assertEquals(54, newCard.cards.length);

        // 验证没有空牌
        for (int i = 0; i < newCard.cards.length; i++) {
            assertNotNull("第" + (i+1) + "张牌为空", newCard.cards[i]);
        }

        System.out.println("\n总共：" + newCard.cards.length + "张牌");
    }


}
